home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
DockExtenders
/
Locus
/
Source
/
ErrorReporting.m
< prev
next >
Wrap
Text File
|
1993-04-08
|
2KB
|
148 lines
/*
Copyright 1993 Jeremy Slade. All rights reserved.
*/
#import "ErrorReporting.h"
#import <stdarg.h>
#import <stdio.h>
static unsigned debugLevel = 0;
#define MAX_MSG 1024
@implementation Object ( ErrorReporting )
+ debug:(unsigned)level :(const char *)fmt, ...
/*
Output a formatted debugging message if level is less than or equal to debugLevel
*/
{
va_list params;
char buf[MAX_MSG+1];
if ( level > debugLevel )
return ( self );
va_start ( params, fmt );
vsprintf ( buf, fmt, params );
va_end ( params );
printf ( buf );
return ( self );
}
- debug:(unsigned)level :(const char *)fmt, ...
/*
Output a formatted debugging message if level is less than or equal to debugLevel
*/
{
va_list params;
char buf[MAX_MSG+1];
if ( level > debugLevel )
return ( self );
va_start ( params, fmt );
vsprintf ( buf, fmt, params );
va_end ( params );
printf ( buf );
return ( self );
}
+ setDebugLevel:(unsigned)level
/*
Set the debugging message output threshold
*/
{
debugLevel = level;
return ( self );
}
- setDebugLevel:(unsigned)level
/*
Set the debugging message output threshold
*/
{
debugLevel = level;
return ( self );
}
+ (unsigned)debugLevel
{
return ( debugLevel );
}
- (unsigned)debugLevel
{
return ( debugLevel );
}
// -------------------------------------------------------------------------
// Error Messages
// -------------------------------------------------------------------------
+ errMsg:(const char *)fmt, ...
/*
Output a formatted error message
*/
{
va_list params;
char buf[MAX_MSG+1];
va_start ( params, fmt );
vsprintf ( buf, fmt, params );
va_end ( params );
printf ( buf );
return ( self );
}
- errMsg:(const char *)fmt, ...
/*
Output a formatted error message
*/
{
va_list params;
char buf[MAX_MSG+1];
va_start ( params, fmt );
vsprintf ( buf, fmt, params );
va_end ( params );
printf ( buf );
return ( self );
}
@end